using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableUnionFightRevivePointDao:DaoBase<TableUnionFightRevivePoint>
    {
        public override void AddPrimaryIndex(TableUnionFightRevivePoint model)
        {
            cachePrimary[model.UFRPId.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableUnionFightRevivePoint.txt";
        }

        protected override TableUnionFightRevivePoint ParseRowData(string[] rowData)
        {
            TableUnionFightRevivePoint data = new TableUnionFightRevivePoint();

            if (string.IsNullOrEmpty(rowData[0]))
            {
                data.UFRPId = 0;
            }
            else
            {
                data.UFRPId = int.Parse(rowData[0]);
            }

            if (string.IsNullOrEmpty(rowData[1]))
            {
                data.UFId = 0;
            }
            else
            {
                data.UFId = int.Parse(rowData[1]);
            }
			data.Position = rowData [2];

            if (string.IsNullOrEmpty(rowData[3]))
            {
                data.InitCamp = 0;
            }
            else
            {
                data.InitCamp = int.Parse(rowData[3]);
            }

            if (string.IsNullOrEmpty(rowData[4]))
            {
                data.Height = 0;
            }
            else
            {
                data.Height = double.Parse(rowData[4]);
            }

            if (string.IsNullOrEmpty(rowData[5]))
            {
                data.IsCanOccupy = 0;
            }
            else
            {
                data.IsCanOccupy = int.Parse(rowData[5]);
            }

            if (string.IsNullOrEmpty(rowData[6]))
            {
                data.SafeRange = 0;
            }
            else
            {
                data.SafeRange = double.Parse(rowData[6]);
            }

            if (string.IsNullOrEmpty(rowData[7]))
            {
                data.OccupyRange = 0;
            }
            else
            {
                data.OccupyRange = double.Parse(rowData[7]);
            }
			data.ModelUrl = rowData [8];

            return data;
        }


        public override void AddOneIndex(TableUnionFightRevivePoint model)
        {
            if (!cacheOneIndex.ContainsKey(model.UFId.ToString()))
            {
                cacheOneIndex[model.UFId.ToString()] = new List<TableUnionFightRevivePoint>();
            }
            cacheOneIndex[model.UFId.ToString()].Add(model);
        }
    

    }

}
